package com.cy.pj.module.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ModelViewController {

    @RequestMapping("/doModelController01")
    public String doModelAndView(Model model) {
    model.addAttribute("username","jason");
    model.addAttribute("state","enable");
    return "view";
    //我们这里的相应结果在spring mvc 中会帮我们封装为modelandciew对象
    }

    @RequestMapping("/doModelAndView02")
    public ModelAndView doModelAndView02(ModelAndView mv) {

        mv.addObject("username","jason");
       mv.addObject("state","enable");
       mv.setViewName("view");
        return mv;
        //我们这里的相应结果在spring mvc 中会帮我们封装为modelandciew对象
    }
    }

